layui.use(["element", 'layer', 'form', 'table'], function () {
  var element = layui.element,
    form = layui.form,
    layer = layui.layer,
    table = layui.table;

  // $('#searchBtn').on('click', function () {

  // });


});
// AssetCode  资产代码  

var vm = new Vue({
  el: '#app',
  data: {
    AssetClass: '0',
    CompanyName: '',
    AssetName: '',
    ArrData: [],
    totalVisible: false,
    tableIns: [],
    defaultData: []
  },
  mounted: function () {
    this.init()
  },
  methods: {
    init: function () {
      localStorage.setItem('navigation', '<a href="#">首页</a><span lay-separator="">/</span><a href="">产品查询</a><span lay-separator="">/</span><a><cite>可购买产品查询</cite></a>');
      var arry = ["1;建行“乾元-私享”理财产品2018年第298期;100万;111天;2018.12.10-2018.12.12;2018.12.13;2019.4.3;在售;4.1%;机构类;2", "2;建行“乾元-众享”理财产品2018年第245期;1万;94天;2018.12.6-2018.12.13;2018.12.14;2019.3.18;在售;3.3%;个人类;2", "3;建行“乾元-众享”理财产品2018年第247期;1万;248天;2018.12.6-2018.12.13;2018.12.14;2019.8.19;在售;3.5%;个人和机构;3"]; arry.map(item => {
        var keyData = item.split(";");
        var obj = {};
        keyData.map((item, index) => {
          if (index == 0) {
            obj['id'] = item;
          } else {
            obj['field' + index] = item;
          }
        });
        this.ArrData.push(obj);
      });
      this.defaultData = this.tableIns = this.ArrData;
    },
    searchBtn: function () {
      var Arr = [];
      var u1_input = $("#u1_input").val();
      var u2_input = $("#u2_input").val();
      var u4_input = $("#u4_input").val();
      this.ArrData = this.defaultData;
      if(u1_input==0&&u2_input==0&&u4_input==0){
        this.ArrData = this.defaultData;
        return;
      }
      Arr = this.ArrData.filter(function (item) {
        if (u1_input != 0) {
          if (u2_input != 0) {
            if (u4_input != 0) {
              return item.field9 == u1_input && item.field10 == u2_input && item.field2 == u4_input
            }
            else {
              return item.field9 == u1_input && item.field10 == u2_input
            }
          }
          else {
            if (u4_input != 0) {
              return item.field9 == u1_input && item.field2 == u4_input
            }
            else {
              return item.field9 == u1_input
            }
          }
        }
        else {
          if (u2_input && u4_input) {
            return item.field10 == u2_input && item.field2 == u4_input
          }
          else {
            return u2_input ? item.field10 == u2_input : item.field2 == u4_input
          }
        }
      });
      this.ArrData = Arr;
    }
  }
})